package com.bstek.bdf2.protal.manageProtal;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.data.provider.Page;
import com.bstek.utils.AppUtils;

import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

 
/**
 * @author admin
 *
 */
@Controller(ManageProtaMaintain.BEAN_ID)
public class ManageProtaMaintain{

	public static final String BEAN_ID="mes.ManageProtaMaintain";
	
	@Resource
	private ManageProtalDao manageProtalDao;
	
	 
	/** 
	 *  查询门户内容
	 * @param page
	 * @param parameter
	 * mes.ManageProtaMaintain#getManageProta
	 */
	@DataProvider
	public void getManageProta(Page<ManageProtal> page, Map<String, Object> parameter){
		this.manageProtalDao.queryManageProtal(page, parameter);
	}
	 
	 
	/**
	 * 保存内容
	 * @param coll
	 * mes.ManageProtaMaintain#saveManageProta
	 */
	@DataResolver
	@Transactional(rollbackFor = Exception.class)
	public void saveManageProta(Collection<ManageProtal> coll){
		this.manageProtalDao.saveManageProtal(coll);
	}
	
 
	
	 
	/** 
	 *  查询门户内容
	 * @param page
	 * @param parameter
	 * mes.ManageProtaMaintain#getData
	 */
	@DataProvider
	public Collection<Map<String, Object>> getData(Page<?> page, Map<String, Object> parameter) {

		return getMaps();

	}

	public static Collection<Map<String, Object>> getMaps() {
		HashMap<String, Object> map = new HashMap<String, Object>();
		map.put("id", AppUtils.generateUUID());
		map.put("commnet", "xxxxxxxxxxx1xxxxxx");

		HashMap<String, Object> map2 = new HashMap<String, Object>();
		map2.put("id", AppUtils.generateUUID());
		map2.put("commnet", "xxxxxxxxxxx2xxxxxxxxxx");
		ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
		list.add(map);
		list.add(map2);
		System.err.println("================"+list);
		return list;
	}

}
